package com.weibiao.zhuhai.concurrent.xiezuo;

public class WaitThread extends Thread{
	private static volatile boolean fire = false;
	@Override
	public void run() {
		synchronized (this) {
			while(!fire){
				try {
					this.wait(0);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
			System.out.print("B");
			System.out.println("C");
			System.out.println();
		}
	};
	public synchronized void fire(){
		this.fire = true;
		System.out.print("A");
		this.notify();
	}
	
	public static void main(String[] args) throws InterruptedException {
		for (; ; ) {
			WaitThread waitThread = new WaitThread();
			waitThread.start();
			waitThread.fire();
			waitThread.join();
		}
	}
}
